﻿using Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Threading;
using SqlSugar;

namespace BLL
{
    public class B_Teacher
    {
        DAL.D_Teacher d_teacher = new DAL.D_Teacher();

        public int Add_custom(List<Teacher> list)
        {
            var res = d_teacher.Add_custom(list);
            return res;
        }

        public List<Teacher> GetList(int grade, int config_id)
        {
            return d_teacher.GetList(grade, config_id);
        }

        public List<Teacher> GetList()
        {
            return d_teacher.GetList();
        }

        public bool Login(Models.Teacher teacher)
        {
            //var res = d_teacher.Login_sugar(teacher);

            int i = 0;
            bool res = false;
            while (!(res = d_teacher.Login_sugar(teacher)))
            {
                i++;
                if (i == 3)
                    break;
            }

            DAL.D_config d_Config = new DAL.D_config();
            log_info.sys_Configs = d_Config.list_config();
            
            return res;
        }
    }
}
